import Vue from 'vue'
import VueRouter from 'vue-router'
import Home from '../views/Home.vue'
import SelectCate from '../views/SelectCate.vue'
import NewsList from '../views/NewsList.vue'
import NewsDetails from '../views/NewsDetails.vue'

Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    redirect:'/home/newslist/1'
  },
  {
    path: '/home',
    name: 'Home',
    component: Home,
    children:[
      {
        path:'newslist/:id',
        name:'NewsList',
        component:NewsList
      }
    ]
  },
  {
    path:'/selectcate',
    name:'SelectCate',
    component:SelectCate
  },
  {
    // 配置新闻详情页路由
    path:'/newsdetails/:id',
    name:'NewsDetails',
    component:NewsDetails
  }
  

]

const router = new VueRouter({
  routes
})

export default router